<?php

namespace maotool\http;

/**
 * HTTP响应封装类
 * 用于封装HTTP请求的响应结果，包括响应体和状态码
 */
class HttpResponse
{
    /** @var string 响应体内容 */
    private $body;

    /** @var int HTTP状态码 */
    private $statusCode;

    /**
     * 构造函数
     *
     * @param string $body 响应体内容
     * @param int $statusCode HTTP状态码
     */
    public function __construct($body, $statusCode)
    {
        $this->body = $body;
        $this->statusCode = (int)$statusCode;
    }

    /**
     * 获取响应体内容
     *
     * @return string 响应体内容
     */
    public function body()
    {
        return $this->body;
    }

    /**
     * 获取HTTP状态码
     *
     * @return int HTTP状态码
     */
    public function statusCode()
    {
        return $this->statusCode;
    }

}
